import 'package:get/get.dart';
import 'package:study_demo/base/BaseController.dart';
import 'package:study_demo/ui/getx_template/getx_template_generate_page.dart';
import 'package:study_demo/ui/json_to_model/json_to_model_page.dart';
import 'package:url_launcher/url_launcher.dart';

class ToolController extends BaseController {
  final pdfToPngUrl = 'https://ol.woobx.cn/tool/pdf2img';
  final pngToWebPUrl = 'https://tinypng.com/';
  final codeUrl = 'https://cli.im/';
  final jsonCheckUrl = 'https://www.bejson.com/';
  final wordToAudioUrl = 'https://ttsmaker.cn/';

  generateCode() {
    goUrl(codeUrl);
  }

  pdfToPng() {
    goUrl(pdfToPngUrl);
  }

  pngToWebP() {
    goUrl(pngToWebPUrl);
  }

  jsonCheck() {
    goUrl(jsonCheckUrl);
  }

  goUrl(String url) {
    launchUrl(Uri.parse(url));
  }

  goGetXTemplateGeneratePage() {
    Get.to(GetXTemplateGeneratePage());
  }

  goJsonToModelPage() {
    Get.to(JsonToModelPage());
  }

  goWordToAudio() {
    launchUrl(Uri.parse(wordToAudioUrl));
  }
}
